package com.ruoyi.project.WebMoudle.carouselSeat.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.WebMoudle.carouselSeat.mapper.CarouselSeatMapper;
import com.ruoyi.project.WebMoudle.carouselSeat.domain.CarouselSeat;
import com.ruoyi.project.WebMoudle.carouselSeat.service.ICarouselSeatService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 轮播位置Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-07-06
 */
@Service
public class CarouselSeatServiceImpl implements ICarouselSeatService 
{
    @Autowired
    private CarouselSeatMapper carouselSeatMapper;

    /**
     * 查询轮播位置
     * 
     * @param id 轮播位置ID
     * @return 轮播位置
     */
    @Override
    public CarouselSeat selectCarouselSeatById(Long id)
    {
        return carouselSeatMapper.selectCarouselSeatById(id);
    }

    /**
     * 查询轮播位置列表
     * 
     * @param carouselSeat 轮播位置
     * @return 轮播位置
     */
    @Override
    public List<CarouselSeat> selectCarouselSeatList(CarouselSeat carouselSeat)
    {
        return carouselSeatMapper.selectCarouselSeatList(carouselSeat);
    }

    /**
     * 新增轮播位置
     * 
     * @param carouselSeat 轮播位置
     * @return 结果
     */
    @Override
    public int insertCarouselSeat(CarouselSeat carouselSeat)
    {
        return carouselSeatMapper.insertCarouselSeat(carouselSeat);
    }

    /**
     * 修改轮播位置
     * 
     * @param carouselSeat 轮播位置
     * @return 结果
     */
    @Override
    public int updateCarouselSeat(CarouselSeat carouselSeat)
    {
        return carouselSeatMapper.updateCarouselSeat(carouselSeat);
    }

    /**
     * 删除轮播位置对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCarouselSeatByIds(String ids)
    {
        return carouselSeatMapper.deleteCarouselSeatByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除轮播位置信息
     * 
     * @param id 轮播位置ID
     * @return 结果
     */
    @Override
    public int deleteCarouselSeatById(Long id)
    {
        return carouselSeatMapper.deleteCarouselSeatById(id);
    }

    @Override
    public String checkNumUnique(CarouselSeat carouselSeat) {
        CarouselSeat cs= carouselSeatMapper.checkNumUnique(carouselSeat);
        if (cs==null){
            return "0";
        }
        return "1";
    }

    @Override
    public List<CarouselSeat> queryUsableSeat(String startTime, String endTime) {
        return carouselSeatMapper.queryUsableSeat(startTime,endTime);
    }
}
